package com.zrar.easyweb.demo.uc.dao;

import com.zrar.easyweb.demo.uc.vo.UserDetails;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 用户dao接口
 *
 * @author green
 * @date 2019/11/14
 * @company 安人股份
 * @desc
 */
public interface UserDao {

    /**
     * 通过XML方式实现
     *
     * @param id
     * @return
     */
    UserDetails userQuery(@Param("userId") String id);


    /**
     * 通过注解方式实现
     *
     * @return
     */
    @Select("SELECT * FROM S_USER")
    @Results(id = "user", value = {
            @Result(property = "userId", column = "ID"),
            @Result(property = "userName", column = "NAME"),
            @Result(property = "email", column = "EMAIL")
    })
    List<UserDetails> list();


    /**
     * 修改邮箱地址
     *
     * @param userId
     * @param email
     */
    @Update("update S_USER set email=#{email} where id=#{id}")
    int updateUserEmail(@Param("id") String userId, @Param("email") String email);

}
